//###############
// FILE : SizeComparator.java
// WRITER : Yaron Dinur, yarondi, 200184992
// WRITER : Yuval Ran, yuvran21, 032513483
// EXERCISE : oop ex1 2011
// DESCRIPTION:
//Compares two files by their size in bytes
//###############

package orders;

import java.io.File;
import java.util.Comparator;

public class SizeComparator extends AbsComparator {
	
	// Compares the number of bytes.
	public int compare(File file1, File file2) {
		
		Long l1 = new Long (file1.length());
		Long l2 = new Long (file2.length());
		
		int result = l1.compareTo(l2);
		
		if (result == 0)
			return super.compare(file1, file2);		
		return result;
	}

}
